{extend name='admin@main'}

{block name="button"}

{if auth("admin/product.goods/add")}
<!-- <button data-modal='{:url("add")}' data-title="添加套餐" class='layui-btn layui-btn-sm layui-btn-primary'>添加套餐</button> -->
{/if}


{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='product/proclass/index_search'}
    <div class="layui-tab layui-tab-card think-bg-white">
        <ul class="layui-tab-title notselect">
            <li data-type='' {if $Think.get.status eq 0} class="layui-this" {/if} data-open='{:url("")}?status=0&page=1'>全部</li>
            <li data-type="" {if $Think.get.status eq 1} class="layui-this" {/if} data-open='{:url("")}?status=1&page=1'>正常</li>
            <li data-type="" {if $Think.get.status eq 2} class="layui-this" {/if} data-open='{:url("")}?status=2&page=1'>禁用</li>
        </ul>
    </div>
    {if auth("admin/product.proclass/add")}
    <div class="layui-obj">
        <button data-modal='{:url("add")}' data-title="添加产品分类" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
    </div>
    {/if}
    <table class="layui-table margin-top-0" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap'>产品分类名称</th>
            <th class='text-left nowrap'>逾期预警天数</th>
            <th class='text-left nowrap'>逾期天数</th>
            <th class='text-left nowrap'>效果图预警天数</th>
            <th class='text-left nowrap'>发邮箱预警天数</th>
            <th class='text-center nowrap'>状态</th>
            <th class="text-left">创建时间</th>
            <th class="text-left">更新时间</th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
            </td>
            <td class='list-table-sort-td'>
                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
            </td>
            <td class='text-left nowrap'>{$vo.name|default=''}</td>
            <td class='text-left nowrap'>{$vo.overdue_warning_day|default=''}</td>
            <td class='text-left nowrap'>{$vo.overdue_day|default=''}</td>
            <td class='text-left nowrap'>{$vo.check_warning_day|default=''}</td>
            <td class='text-left nowrap'>{$vo.email_warning_day|default=''}</td>
            <td class='text-center nowrap'>
                {eq name='vo.status' value='2'}<span class="color-red">禁用</span>{else}<span class="color-green">正常</span>{/eq}
            </td>
            <td class='text-left nowrap'>日期：{$vo.create_at|format_datetime|str_replace=' ','<br><span class="color-desc">时间：',###|raw}</span></td>
            <td class='text-left nowrap'>日期：{$vo.update_at|format_datetime|str_replace=' ','<br><span class="color-desc">时间：',###|raw}</span></td>
            <td class='text-left nowrap'>
                {if auth("admin/product.proclass/edit")}
                <a data-dbclick data-title="编辑产品分类" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                {/if}
                {if $vo.status eq 1 and auth("admin/product.proclass/forbid")}
                <a class="layui-btn layui-btn-warm layui-btn-sm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#2" data-csrf="{:systoken('admin/product.proclass/forbid')}">禁 用</a>
                {elseif $vo.status eq 2 and auth("admin/product.proclass/resume")}
                <a class="layui-btn layui-btn-warm layui-btn-sm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('admin/product.proclass/resume')}">启 用</a>
                {/if}              
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
<style>
	.layui-obj{
        margin-top: 10px!important;
    }
    .layui-tab{
        margin-top: 10px!important;
    }
	.layui-table td, .layui-table th {
		box-sizing: border-box;
	}
</style>
{/block}
